<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        var reg = new RegExp("ab", "i");
        var str = "a";
        var result = reg.test(str);
        console.log(result);

        // test
        let bo = /e/.test("chenzhfei")
        console.log("判断字符串中是否含有e:", bo)

        //exec
        let ex = /e/.exec("chenzhfiei");
        console.log("搜索字符串1中是否含有e:", ex)
        let ex2 = /e/.exec("guoffff");
        console.log("搜索字符串2中是否含有e:", ex2)
    </script>


</body>

</html>